TUTORIAL 3: DATA STORAGE
Introduction
This tutorial introduces data resources and the storage model. We'll be creating a program to display a bitmap on an SD card onto the TFT display, although the same principles would hold true for audio (.WAV) files on the Wave Shield.
It is assumed as this stage that you have worked through the other tutorials and are familiar with general placement and connecting of flowblocks.
You can watch a short movie of this tutorial on the Labcenter Youtube Channel.
Setup
We'll set up this project in the usual way via the new project wizard and configure it as an Arduino Uno flowchart project.

Next, we'll want to add our peripheral shield. We right click on the Project Tree and add the Adafruit TFT shield. Note that this is not a module for the Grove Shield but a completely different shield which contains both an SD card and a TFT display.

The last thing we need to do is add the resource. In our case this is the picture that we want to store in the SD card and display on the TFT display. We do this via the Add Resource command on the right click context menu.

Be careful with the naming of resource files. The Arduino SD stack by default supports only 8.3 filenames in order to support FAT16 cards. This means that the namestem must be 8 characters or less and the extension must be 3 characters or less. For example, a picture called ProteusLogo.bmp will not load whereas renaming it to logo.bmp or image.bmp will work fine.
Designing the Program
Now that we have all the pieces we need, the remaining job is to create the program. This could hardly be easier in Visual Designer. First, drag the fillSreen() method onto the top of the loop and set the fill colour to black.

Next drag and drop the bitmap resource into the loop routine. Visual Designer knows that the only sensible target for the resource is the TFT display and it knows the method for rendering the resource is drawBitmap() and so it will automatically configure the flowblock for you.

Now you need to edit the Image and set the xPos and yPos to be 0

Press the play button to compile and run the simulation.

If necessary, you can configure the rotation in the setup routine via the same drag and drop method.

Taking Measurements
One of the nice things about Visual Designer is that it contains the Proteus schematic. This means that, if you want to, you can look a little deeper at what is happening in your design. For example, in our example the SD card is connected to the processor on the SPI bus and so we can place and wire a protocol analyzer to examine the SPI packets. In Proteus, all signals and waveforms travel through the wires, and two terminals with the same name have an 'invisible wire' between them.

Two terminals with the same name are connected together as though they were wired.
Given this, the easiest way to connect the SPI terminal is to place one and wire it to terminals with the same names as the other SPI lines. The alternative is to connect up to existing wires.
Placing a SPI Analyser:

Wiring SPI Analyser:

Next, set a breakpoint in the drawBitmap() command as this is where the majority of the SPI transmissions happen.

Now, when we run the simulation we'll see some initialisation chatter on the SPI bus until we hit our breakpoint. When we single step, we will see an awful lot of data being moved from the SD card corresponding to the bitmap being read by the processor. You can drill all the way down to bit level on any packet if need be.
The same basic process will work with any instrument (Oscilloscope, Logic Analyser, I2C Analyser etc.).
Attaching instrumentation is essential for analysis but will slow down simulation. It's worth deleting instruments when a debug session is complete.
Programming Hardware
When we are finished development we can easily program the physical hardware. First, connect the Adafruit TFT shield to the Arduino Uno and make sure a compatible SD card is inserted in the shield. Then, connect to the PC and then simply press the program button.
![]()
If the upload doesn't start ,use the settings dialogue to specify the COM port that you have connected to and try again.

You should see an upload complete message in the simulation log and your TFT should be displaying the picture.
This programming process is twofold. First, the resource is written to the SD card and then the firmware program is sent to the AVR microcontroller.
They physical SD Card must be FAT16 or FAT32 and big enough to hold the resource file that will be programmed onto it.
See Also:
The next tutorial will show how you can create your own electronics in the schematic (a virtual breadboard).